package com.chrray.position.mapper.position;
import com.chrray.position.mapper.position.base.SysRoleMenuBaseMapper;
import com.chrray.position.entity.position.SysRoleMenu;
import com.chrray.position.pojo.dto.auth.SysMenuTreeDto;
import com.chrray.position.pojo.dto.auth.SysOperationDto;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;

import java.util.List;

/**
 *系统角色菜单关系 数据访问
 @author lm
 */
public interface SysRoleMenuMapper extends Mapper<SysRoleMenu>, MySqlMapper<SysRoleMenu>,SysRoleMenuBaseMapper{
    /**
     *根据角色id查询菜单
     * @param roleId
     * @param level
     * @param parentId
     * @return
     */
    List<SysMenuTreeDto> listMenuByRoleIds(@Param("roleId")Long roleId, @Param("level") Integer level, @Param("parentId")  Long parentId);

    List<SysMenuTreeDto> listMenuByRoleIds1(@Param("roleId")Long roleId, @Param("level") Integer level, @Param("parentId")  Long parentId);

    /**
     *根据角色ids和菜单查询按钮权限
     * @param roleId
     * @param menuId
     * @return
     */
    List<SysOperationDto> listOperationByRoleIdsAndMenuId(@Param("roleId") Long roleId, @Param("menuId")Long menuId);

    List<SysOperationDto> listOperationByRoleIdsAndMenuId1(@Param("roleId") Long roleId, @Param("menuId")Long menuId);

    /**
     * 删除角色菜单
     * @param roleId
     * @return
     */
    int delByRoleId(Long roleId);


    /**
     * 根据角色id查询菜单
     * @param roleId
     * @param level
     * @param parentId
     * @return
     */
    List<SysMenuTreeDto> listMenuByRoleId(@Param("roleId") Long roleId,@Param("level") Integer level,@Param("parentId")  Long parentId);
    List<SysMenuTreeDto> listBlocMenuByRoleId(@Param("roleId") Long roleId,@Param("level") Integer level,@Param("parentId")  Long parentId);

    /**
     * 根据角色id和菜单查询按钮权限
     * @param roleId
     * @param menuId
     * @return
     */
    List<SysOperationDto> listOperationByRoleIdAndMenuId(@Param("roleId") Long roleId,@Param("menuId")Long menuId);

    SysRoleMenu selectByRoleIdAndMenuId(@Param("roleId") Long roleId, @Param("menuId")Long menuId, @Param("type") Integer type);
}
